//
//  ActivityDetailView.m
//  UI_豆瓣项目
//
//  Created by dllo on 15/10/31.
//  Copyright (c) 2015年 关业达. All rights reserved.
//

#import "ActivityDetailView.h"
#import "UIImageView+WebCache.h"
@implementation ActivityDetailView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self xiangqing];
    }
    return self;
}

- (void)xiangqing
{
    self.titleLable = [[UILabel alloc] initWithFrame:CGRectMake(15, 15, 200, 35)];
//    self.titleLable.backgroundColor = [UIColor redColor];
    self.titleLable.font = [UIFont systemFontOfSize:20];
    [self addSubview:self.titleLable];
    [_titleLable release];
    
    self.movieImageView = [[UIImageView alloc] initWithFrame:CGRectMake(15, 75, 120, 180)];
//    self.movieImageView.backgroundColor = [UIColor yellowColor];
    [self addSubview:self.movieImageView];
    [_movieImageView release];
    
    self.timeImageView = [[UIImageView alloc] initWithFrame:CGRectMake(140, 80, 25, 25)];
    [self.timeImageView setImage:[UIImage imageNamed:@"icon_date_blue.png"]];
//    self.timeImageView.backgroundColor = [UIColor yellowColor];
    [self addSubview:self.timeImageView];
    [_timeImageView release];
    
    
    
    self.timeLabel = [[UILabel alloc] initWithFrame:CGRectMake(180, 80, 200, 25)];
//    self.timeLabel.backgroundColor = [UIColor redColor];
    [self addSubview:self.timeLabel];
    [_timeLabel release];
    
    self.hostImageView = [[UIImageView alloc] initWithFrame:CGRectMake(140, 120, 25, 25)];
    [self.hostImageView setImage:[UIImage imageNamed:@"icon_sponsor_blue.png"]];
//    self.hostImageView.backgroundColor = [UIColor yellowColor];
    [self addSubview:self.hostImageView];
    [_hostImageView release];
    
    self.hostLable = [[UILabel alloc] initWithFrame:CGRectMake(180, 120, 200, 25)];
//    self.hostLable.backgroundColor = [UIColor redColor];
    [self addSubview:self.hostLable];
    [_hostLable release];
    
    self.charImageView = [[UIImageView alloc] initWithFrame:CGRectMake(140, 160, 25, 25)];
    [self.charImageView setImage:[UIImage imageNamed:@"icon_catalog_blue.png"]];
//    self.charImageView.backgroundColor = [UIColor yellowColor];
    [self addSubview:self.charImageView];
    [_charImageView release];
    
    UILabel *label1 = [[UILabel alloc] initWithFrame:CGRectMake(180, 160, 100, 25)];
    label1.text = @"类型:";
    [self addSubview:label1];
    [label1 release];
    
    self.charLable = [[UILabel alloc] initWithFrame:CGRectMake(225, 160, 150, 25)];
//    self.charLable.backgroundColor = [UIColor redColor];
    [self addSubview:self.charLable];
    [_charLable release];
    
    self.adressImageView = [[UIImageView alloc] initWithFrame:CGRectMake(140, 200, 25, 25)];
    [self.adressImageView setImage:[UIImage imageNamed:@"icon_spot_blue.png"]];
//    self.adressImageView.backgroundColor = [UIColor yellowColor];
    [self addSubview:self.adressImageView];
    [_adressImageView release];
    
    self.addressLable = [[UILabel alloc] initWithFrame:CGRectMake(180, 200, 180, 50)];
//    self.addressLable.backgroundColor = [UIColor redColor];
    self.addressLable.numberOfLines = 0;
    [self addSubview:self.addressLable];
    [_addressLable release];
    
    self.introductionLable = [[UILabel alloc] initWithFrame:CGRectMake(15, 268, 200, 35)];
    self.introductionLable.font = [UIFont systemFontOfSize:20];
//    self.introductionLable.backgroundColor = [UIColor redColor];
    [self addSubview:self.introductionLable];
    [_introductionLable release];
    
    
    self.contentLable = [[UILabel alloc] initWithFrame:CGRectMake(15, 300, 345, 300)];
//    self.contentLable.backgroundColor = [UIColor redColor];
    self.contentLable.numberOfLines = 0;
    [self addSubview:self.contentLable];
    [_contentLable release];
    
    
    
}

- (void)setBactivity:(Activity *)Bactivity
{
    if (_Bactivity != Bactivity) {
        [_Bactivity release];
        _Bactivity = [Bactivity retain];
    }
    self.timeLabel.text = self.Bactivity.begin_time;
    self.titleLable.text = self.Bactivity.title;
    self.hostLable.text = self.Bactivity.name;
    self.charLable.text = self.Bactivity.category_name;
    self.addressLable.text = self.Bactivity.address;
    self.introductionLable.text = @"活动介绍";
    self.contentLable.text = self.Bactivity.content;
    
    // 图片解析
    NSURL *url = [NSURL URLWithString:self.Bactivity.Aimage];
    [self.movieImageView sd_setImageWithURL:url placeholderImage:[UIImage imageNamed:@"1.jpg"]];
    
}







/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
